<template>
  <template v-for="(item, index) in routers">
    <el-sub-menu v-if="item.children" :index="item.path">
      <template #title>
        <el-icon>
          <component :is="item.meta.icon"></component>
        </el-icon>
        <span>{{ item.meta.title }}</span>
      </template>
      <!-- 一会用递归 -->
      <Menu :routers="item.children"></Menu>
    </el-sub-menu>
    <el-menu-item v-else :index="item.path">
      <el-icon>
        <component :is="item.meta.icon"></component>
      </el-icon>
      <span>{{ item.meta.title }}</span>
    </el-menu-item>
  </template>
</template>

<script setup>
import { ref } from 'vue'
import Menu from '@/components/Menu/index.vue'
defineProps(['routers'])
// console.log(routers)
</script>
<style scoped></style>
